package test;

import hapi.util.DynamicImporter;
import haxe.unit.TestCase;

class TestDynamicImporter extends TestCase {

	//public function testProperCall() {
		//var value = "looks ok!";
		//var data = { test:value };
		//var importer:TestInterface = cast new DynamicImporter(data);
		//this.assertEquals( value, importer.provideTest());
	//}
	//
	//public function testImproperCall() {
		//var value = "looks ok!";
		//var data = { test:value };
		//var importer:TestInterface = cast  new DynamicImporter(data);
		//trace("test "+importer.getTest, "info");
		//this.assertEquals( null, (importer.getTest)());
	//}
	
	public function testImplementingInterfaceDefaultPrefix() {
		var data = { counter:123 };
		var importer:SomeImporter = DynamicImporter.create(SomeImporter, data);
		this.assertEquals( 123, (importer.provideCounter)());
	}
	
	public function testImplementingInterfaceWithPrefix() {
		var data = { counter:123 };
		var importer:SomeImporter = DynamicImporter.create(SomeImporter, data, "getMy");
		this.assertEquals( 123, importer.getMyCounter());
	}
}

interface TestInterface {
	public function getTest():String;
	public function provideTest():String;
}

interface SomeImporter {
	public function getMyCounter():Int;
	public function provideCounter():Int;
}